package com.itboye.shop.me.qianbao;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.shop.R;
import com.itboye.shop.base.BaseActivity;
import com.itboye.shop.util.helper.utils.OnPasswordInputFinish;
import com.itboye.shop.util.helper.utils.PasswordView;

/**
 * 记得支付密码
 */
public class JiDeZhiFuPassActivity extends BaseActivity {
    TextView tvTitle;
    ImageView back;

    PasswordView pwdView;// 支付密码
    String paypent_pass;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ji_de_zhi_fu_pass);
        tvTitle.setText("重置支付密码");

        final PasswordView pwdView = (PasswordView) findViewById(R.id.pwd_view);

        // 添加密码输入完成的响应
        pwdView.setOnFinishInput(new OnPasswordInputFinish() {
            @Override
            public void inputFinish() {
                // 输入完成后跳转
                // 也就是说——>实现你的交易逻辑什么的在这里写

                paypent_pass = pwdView.getStrPassword();

                Intent intent = new Intent(JiDeZhiFuPassActivity.this, JiDePassTwoActivity.class);
                intent.putExtra("paypent", paypent_pass);
                startActivity(intent);
                finish();
            }
        });
        //支付密码修改成功的广播
        IntentFilter intentFilterExit = new IntentFilter(JiDePassTwoActivity.ZHI_FU_PASS_OK);
        registerReceiver(xiugaiPassBroadcastReceiver, intentFilterExit);
    }
    BroadcastReceiver xiugaiPassBroadcastReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            finish();
        };
    };

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unregisterReceiver(xiugaiPassBroadcastReceiver);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.back:
                finish();
                break;
            default:
                break;
        }
    }
}
